<extend name="Public/base"/>
<block name="body">


<div class="tab-content">

  <form method="post" class="form-horizontal J_ajaxForm" action="{:U("")}">
      <div class="table_full">
     <table width="100%" cellspacing="0" id="menus-table">
        <tbody>
         {$categorys}
        </tbody>
      </table>
    </div>
      <div class="form-actions">
        <input type="hidden" name="id" value="{$group_id}" />
           <button class="btn btn-info ajax-post"   target-form="J_ajaxForm"  type="submit">授权</button>
           
            <a class="btn btn-return" href="__URL__" >返 回</a>
      </div>
    </form>

</div>
</block>


<block name="script">
 <link href="__JS__/treeTable/treeTable.css" rel="stylesheet" />
<script src="__JS__/treeTable/treeTable.js"></script> 

<script>

$(document).ready(function () {
	 $("#menus-table").treeTable({
            indent: 20
        });
});
function checknode(obj) {
    var chk = $("input[type='checkbox']");
    var count = chk.length;
    var num = chk.index(obj);
    var level_top = level_bottom = chk.eq(num).attr('level');
    for (var i = num; i >= 0; i--) {
        var le = chk.eq(i).attr('level');
        if (eval(le) < eval(level_top)) {
            chk.eq(i).attr("checked", true);
            var level_top = level_top - 1;
        }
    }
    for (var j = num + 1; j < count; j++) {
        var le = chk.eq(j).attr('level');
        if (chk.eq(num).attr("checked") == "checked") {
            if (eval(le) > eval(level_bottom)){
            	chk.eq(j).attr("checked", true);
            }
            else if (eval(le) == eval(level_bottom)){
            	break;
            }
        } else {
            if (eval(le) > eval(level_bottom)){
            	chk.eq(j).attr("checked", false);
            }else if(eval(le) == eval(level_bottom)){
            	break;
            }
        }
    }
}

</script></block>

